package com.stiove.whwh.Controller;


import com.stiove.whwh.service.TicketService;
import com.stiove.whwh.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ticket")
public class TicketController {

    @Autowired
    private TicketService ticketService;

    @GetMapping("/list")
    public Result getTicketForIndex(@RequestParam String city ,int sort,int status,int page){
        return ticketService.getTicketList(city,sort,status,page);
    }

    @GetMapping("/{id}")
    public Result getTicketById(@PathVariable("id") int id){
        return ticketService.getTicketInfo(id);
    }

    @GetMapping("/banner")
    public Result getTicketBanner(){
        return ticketService.getTicketBannerList();
    }

    @GetMapping("/search")
    public Result searchTicketList(@RequestParam String input,int page){
        return ticketService.searchTicketList(input,page);
    }

    @GetMapping("/hot")
    public Result getTicketByHot(){
        return ticketService.getTicketByHot();
    }

    @PostMapping("/like")
    public Result likeTicket(@RequestParam("id") int id){
        return ticketService.likeTicket(id);
    }

    @GetMapping("/like")
    public Result getLikeTicket(@RequestParam int page){
        return ticketService.getLikeTicket(page);
    }

    @DeleteMapping ("/like")
    public Result delLike(@RequestParam int id){
        return ticketService.delLike(id);
    }

}
